// 使用promise 进行封装 导出异步请求的方法
// const url =

export const getUserProfile = () =>
	new Promise((resolve, reject) =>
		uni.getUserProfile({
			desc: "获取用户个人信息",
			success: res => resolve(res),
			fail: error => {
				uni.showToast({
					title: "用户拒绝了获取个人信息"
				})
				reject(error)
			}
		})
	)

export const login = () =>
	new Promise((resolve, reject) =>
		uni.login({
			success: res => resolve(res),
			fail: error => reject(error)
		})
	)

// 添加一个支付的函数
export const requestPayment = params =>
	new Promise((resolve, reject) =>
		uni.requestPayment({
			...params,
			success: (res) => resolve(res),
			fail: (error) => reject(error)
		})
	)
